package game.constHlp
{
	import laya.utils.Dictionary;

	/**
	 *@date 2017-2-21 上午11:17:29
	 *@author zhouhonghui
	 */
	public class RoleActions
	{
		public static const FLY:int = 1;
		public static const DOWN:int = 2;
		public static const HIT:int = 2;
		
		private static var _actions:Dictionary;
		/**敌人 飞行，下落，击中 状态的帧数 **/
		private static var enemyFrameInf:Array =  [
			[1,4],
			[1,4,1],
			[2,6,1],
		];
		/** 所有动作定义 **/
		private static var allActions:Array=[FLY,DOWN,HIT]; 
		
		public function RoleActions()
		{
		}
		/**
		 * 获取动作帧信息 
		 * @param key
		 * @param action
		 * @return 
		 * 
		 */		
		public static function getActionInf(key:String,action:int):Object
		{
			if(!_actions)
			{
				_actions = new Dictionary();
				
				_actions['hero']=new Dictionary();
				_actions['hero'][FLY] = {count:2,urlFix:"hero_"};
				_actions['hero'][DOWN] = {count:4,urlFix:"hero_"};				
				var enemyNum:int = 3;				
				for (var i:int = 0; i < enemyNum; i++) 
				{
					var idx:int = i+1;
					var namekey:String = 'enemy'+idx;
					_actions[namekey] = new Dictionary();
					var frames:Array = enemyFrameInf[i];
					for (var j:int = 0; j < allActions.length; j++) 
					{
						if(j<frames.length)
						{
							_actions[namekey][allActions[j]] = {count:frames[allActions[j]-1],urlFix:namekey+"_"};
						}
					}					
				}								
				
			}
			return _actions[key][action];
		}
		
		
	}
}